<template>
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center shopSearch_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-center flex-sub shopSearch_fd0_0'>
					<text class='fu-iconfont2  shopSearch_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
						data-url="1">&#xE794;</text>
					<view class='flex flex-wrap align-center shopSearch_fd0_0_c1'>
						<image class='shopSearch_fd0_0_c1_c0' mode="aspectFit" :src='STATIC_URL+"14.png"'></image>
						<benben-input class='flex-sub shopSearch_fd0_0_c1_c1' type="text" :focus='true'
							:placeholder="`请输入关键字`" confirm-type="done" :maxlength="-1"
							placeholder-style="color:rgba(153, 153, 153, 1);font-size:28rpx"
							@confirm="addSearchHistoryFunc()" v-model="keyword" />
						<image class='shopSearch_fd0_0_c1_c2' mode="aspectFit" v-if="keyword" :src='STATIC_URL+"48.png"'
							@tap.stop="emptyFunc()"></image>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---搜索记录flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout">
				<view class='flex flex-wrap align-center shopSearch_fd1_0'>
					<image class='shopSearch_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"16.png"'></image>
					<text class='shopSearch_fd1_0_c1'>历史搜索</text>
					<image class='shopSearch_fd1_0_c2' mode="aspectFit" :src='STATIC_URL+"15.png"'
						@tap.stop="popupShow1661481796822=true"></image>
				</view>
				<view class='flex flex-wrap align-center shopSearch_fd1_1' v-if=" appSearchHistory.length!=''">
					<template v-for='(item,key0) in appSearchHistory'>
						<view class='flex flex-wrap align-center shopSearch_fd1_1_c0' @tap.stop="handleJumpDiy"
							data-type="navigateTo" :data-url="`/pages/index/resultShop/resultShop?keyword=${item.name}&aid=${aid}`"
							:key='key0'>
							<text class='shopSearch_fd1_1_c0_c0'>{{item.name}}</text>
						</view>
					</template>

				</view>
				<text class='shopSearch_fd1_2' v-if=" appSearchHistory.length==''">暂无历史记录</text>
			</view>

			<!---搜索记录flex布局结束-->
			<benben-popup v-model="popupShow1661481796822" :mask="true" :mask-close-able="true" mode='center'>
				<!---删除历史记录弹窗flex布局开始-->
				<view class="flex flex-direction flex-wrap align-center shopSearch_flex_2">
					<text class='shopSearch_fd2_0'>提示</text>
					<text class='shopSearch_fd2_1'>确定删除历史记录？</text>
					<view class='flex flex-wrap align-center shopSearch_fd2_2'>
						<button class='shopSearch_fd2_2_c0' @tap.stop="popupShow1661481796822=false">取消</button>
						<button class='shopSearch_fd2_2_c1' @tap.stop="emptySearchHistoryFunc()">确认</button>
					</view>
				</view>

				<!---删除历史记录弹窗flex布局结束-->

			</benben-popup>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch benben-flex-layout shopSearch_flex_3">
				<view class='flex flex-wrap align-center shopSearch_fd3_0'>
					<image class='shopSearch_fd3_0_c0' mode="aspectFit" :src='STATIC_URL+"124.png"'></image>
					<text class='shopSearch_fd3_0_c1'>热门搜索</text>
				</view>
				<view class='flex flex-wrap align-center shopSearch_fd3_1'>
					<template v-for='(item,key0) in list'>
						<view class='flex flex-wrap align-center shopSearch_fd3_1_c0' @tap.stop="handleJumpDiy"
								data-type="navigateTo" :data-url="`/pages/index/resultShop/resultShop?keyword=${item.title}&aid=${aid}`">
							<text class='shopSearch_fd3_1_c0_c0'>{{item.title}}</text>
						</view>
					 </template>
				</view>
			</view>

			<!---flex布局flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	export default {
		components: {},


		data() {
			return {
				"popupShow1661481796822": false,
				"keyword": "",
				"aid": "",
				list:'',
			};
		},
		computed: {
			appSearchHistory() { // 搜索历史
				return this.$store.state.appSearchHistory
			}
		},
		watch: {},
		onLoad(options) {
			let {
				aid
			} = options
			if (aid !== undefined) this.aid = aid
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {
			this.getso673a19c85753Func()
		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//用户端-获取热门搜索列表
			async getso673a19c85753Func() {
				//请求方法
				//数据验证

				let datalist = await this.$api.get(global.apiUrls.post6673a19c85753, {

				});

				if (datalist.data.code != 1) {
					this.$message.info(datalist.data.msg);
					return
				}
				let infolist = datalist.data;
				this.list = infolist.data

			},
			//添加搜索历史
			addSearchHistoryFunc() {
				this.$store.commit('appSearchHistoryAdd', {
					"name": this.keyword
				})
				uni.navigateTo({
					url: `/pages/index/resultShop/resultShop?keyword=${this.keyword}&aid=${this.aid}`
				});
			},
			//删除搜索历史
			deleteSearchHistoryFunc(name) {
				this.$store.commit('appSearchHistoryDel', {
					"name": name
				})
			},
			//清空搜索记录
			emptySearchHistoryFunc() {
				this.$store.commit('appSearchHistoryClean', '')
				this.popupShow1661481796822 = false;
			},
			//清空搜索
			emptyFunc() {
				this.keyword = '';
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: var(--benbenbgColor1);
		background-size: 100% auto;
	}

	.shopSearch_flex_0 {
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.shopSearch_fd0_0_c1_c2 {
		width: 32rpx;
		height: 32rpx;
		margin: 0rpx 0rpx 0rpx 20rpx;
	}

	.shopSearch_fd0_0_c1_c1 {
		margin: 0rpx 0rpx 0rpx 16rpx;
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.shopSearch_fd0_0_c1_c0 {
		width: 28rpx;
		height: 28rpx;
	}

	.shopSearch_fd0_0_c1 {
		background: #F6F7F9;
		background-size: 100% auto !important;
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		height: 64rpx;
		margin: 0rpx 0rpx 0rpx 24rpx;
		padding: 0rpx 24rpx 0rpx 24rpx;
		width: 474rpx;
	}

	.shopSearch_fd0_0_c0 {
		font-size: 36rpx;
		color: #333;
		font-weight: 500;
	}

	.shopSearch_fd0_0 {
		height: 88rpx;
		padding: 0rpx 0rpx 0rpx 32rpx;
	}

	.shopSearch_fd1_2 {
		font-size: 24rpx;
		font-weight: 400;
		color: var(--benbenFontColor0);
		margin: 0rpx 32rpx 24rpx 32rpx;
	}

	.shopSearch_fd1_1_c0_c0 {
		font-size: 26rpx;
		font-weight: 400;
		color: #333333;
		line-height: 37rpx;
		text-align: center;
		font-style: normal;
	}

	.shopSearch_fd1_1_c0 {
		background: rgba(246, 247, 249, 1);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 40rpx 0rpx 40rpx;
		line-height: 56rpx;
		margin: 0rpx 12rpx 24rpx 12rpx;
		height: 56rpx;
	}

	.shopSearch_fd1_1 {
		padding: 0rpx 20rpx 0rpx 20rpx;
	}

	.shopSearch_fd1_0_c2 {
		width: 32rpx;
		height: 32rpx;
		margin: 0rpx 0rpx 0rpx auto;
	}

	.shopSearch_fd1_0_c1 {
		font-size: 32rpx;
		font-weight: 600;
		color: #333333;
		line-height: 45rpx;
		text-align: left;
		font-style: normal;
	}

	.shopSearch_fd1_0_c0 {
		width: 28rpx;
		height: 28rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.shopSearch_fd1_0 {
		margin: 32rpx 32rpx 24rpx 32rpx;
	}

	.shopSearch_flex_2 {
		background: #fff;
		margin: 0rpx 105rpx 0rpx 105rpx;
		background-size: #eee;
		border-radius: 25rpx 25rpx 25rpx 25rpx;
		padding: 40rpx 0rpx 0rpx 0rpx;
	}

	.shopSearch_fd2_2_c1 {
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 16rpx 0rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor4);
		width: 269rpx;
		height: 110rpx;
	}

	.shopSearch_fd2_2_c0 {
		border-right: 1px solid #EEEEEE;
		background: transparent;
		line-height: 110rpx;
		border-radius: 0rpx 0rpx 0rpx 16rpx;
		font-size: 32rpx;
		color: var(--benbenFontColor2);
		height: 110rpx;
		width: 270rpx;
	}

	.shopSearch_fd2_2 {
		border-top: 1px solid #eee;
	}

	.shopSearch_fd2_1 {
		font-size: 32rpx;
		font-weight: 400;
		line-height: 52rpx;
		color: #333333;
		margin: 40rpx 0rpx 39rpx 0rpx;
	}

	.shopSearch_fd2_0 {
		color: #333333;
		font-size: 32rpx;
		font-weight: 500;
		line-height: 45rpx;
	}

	.shopSearch_flex_3 {
		margin: 40rpx 0rpx 0rpx 0rpx;
	}

	.shopSearch_fd3_1_c0_c0 {
		font-size: 24rpx;
		font-weight: 400;
		color: rgba(51, 51, 51, 1);
		line-height: 37rpx;
	}

	.shopSearch_fd3_1_c0 {
		background: rgba(246, 247, 249, 1);
		border-radius: 32rpx 32rpx 32rpx 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 40rpx 0rpx 40rpx;
		line-height: 56rpx;
		margin: 0rpx 12rpx 24rpx 12rpx;
		height: 56rpx;
	}

	.shopSearch_fd3_1 {
		padding: 0rpx 20rpx 0rpx 20rpx;
	}

	.shopSearch_fd3_0_c1 {
		font-size: 32rpx;
		font-weight: 600;
		color: #333333;
		line-height: 45rpx;
		text-align: left;
		font-style: normal;
	}

	.shopSearch_fd3_0_c0 {
		width: 28rpx;
		height: 28rpx;
		margin: 0rpx 16rpx 0rpx 0rpx;
	}

	.shopSearch_fd3_0 {
		margin: 0rpx 32rpx 24rpx 32rpx;
	}
</style>
